import request from '../../utils/request.js'

const state = {
	text: '测试数据',
	indexData: {},
}
const mutations = {
	//修改首页数据
	changeIndexDataMutations(state, indexData) {
		state.indexData = indexData;
	}
}
const actions = {
	//发送网络请求  拿首页数据
	async getIndexDataActions({commit}){
		//1、执行异步任务，发送网络请求
		const res = await request('/getIndexData');  //小程序  
		//2、commit 触发mutations
		commit('changeIndexDataMutations',res.indexData);
	}
	
}
const getters = {

}
export default {
	namespaced: true, //所有数据分模块管理
	state,
	mutations,
	actions,
	getters
}